home *** CD-ROM | disk | FTP | other *** search
/ BBS Toolkit / BBS Toolkit.iso / doors_1 / moretim1.zip / MORETIME.BAS < prev    next >
BASIC Source File  |  1991-12-19  |  6KB  |  141 lines

  1. '+--------------------------[ MoreTime Ver 1.10 ]----------------------------+
  2. '|  Written By Gary Meeker 12/18/91                        Updated 12/19/91  |
  3. '|  SYSOP: SHARP Technical Support Line BBS               Lawrenceville, GA  |
  4. '|         (404) 962-1788                 300/1200/2400/9600 Baud. 24 Hours  |
  5. '+---------------------------------------------------------------------------+
  6. 'V1.0 12/18/91 - Initial release
  7. 'V1.1 12/19/91 - Noticed I left off the LEN = 25 for the database file.
  8. '              - Removed PCBDOOR.TXT from .CFG file and onto command line
  9. '                to make multi-node setup easier
  10. '              - Added Bytes Increase value (based on 2400 baud)
  11. '-----------------------------------------------------------------------------
  12.  
  13. DEFINT A-Z
  14.  
  15. '   QuickPack Declarations
  16. DECLARE SUB SetLevel (ErrLevel%)
  17. DECLARE SUB FCopy (Source$, Dest$, Buffer$, ErrCode%)
  18. DECLARE FUNCTION Exist% (FileName$)
  19. DECLARE FUNCTION PDQParse$ (Work$)
  20.  
  21. '   Local Declarations
  22. DECLARE FUNCTION CheckDataBase(UserName$, Recs, FileHandle)
  23.  
  24. TYPE PCBSYSRECORD
  25.     Display AS STRING * 2   'Display On/Off ("-1" = On, " 0" = Off)
  26.     Printer AS STRING * 2   'Printer On/Off ("-1" = On, " 0" = Off)
  27.     PageBell AS STRING * 2  'Page Bell On/Off ("-1" = On, " 0" = Off)
  28.     CallAlarm AS STRING * 2 'Caller Alarm On/Off ("-1" = On, " 0" = Off)
  29.     SysopFlag AS STRING * 1 'Sysop Flag (" ", "N"=sysop next, "X"=exit dos)
  30.     ErrCorr AS STRING * 2   'Error Corrected ("-1" = On, " 0" = Off)
  31.     Graphics AS STRING * 1  'Graphics Mode ('Y'=yes, 'N'=no, '7'=7E1)
  32.     NodeChat AS STRING * 1  'Node Chat Status ('A'=available, 'U'=unavailable)
  33.     DTEPort  AS STRING * 5  'DTE Port Speed (PC to Modem speed)
  34.     Connect  AS STRING * 5  'Connect Speed shown to caller or "Local"
  35.     RecNum   AS INTEGER     'User's Record Number in the USERS file
  36.     FirstName AS STRING * 15 'User's First Name (padded to 15 characters)
  37.     Password AS STRING * 12 'User's Password (padded to 12 characters)
  38.     TimeOn   AS INTEGER     'Time User Logged On (in minutes since midnight)
  39.     TimeUsed AS INTEGER     'Time used so far today (negative number of minutes)
  40.     TimeOnF  AS STRING * 5  'Time User Logged On (in "HH:MM" format)
  41.     DayTime  AS INTEGER     'Time Allowed On (from PWRD file) (see note 1 below)
  42.     DLKbytes AS INTEGER     'Allowed K-Bytes for Download (see note 2 below)
  43.     ConfArea AS STRING * 1  'Conference Area user was in (if <= 255)
  44.     ConfJoined AS STRING * 5 'Conference Areas the user has joined this session
  45.     ConfScaned AS STRING * 5 'Conference Areas the user has scanned this session
  46.     ConfAddTime AS INTEGER  'Conference Add Time in minutes
  47.     CreditTime AS INTEGER   'Upload/Sysop CHAT Credit Minutes (see note 3 below)
  48.     LangExt AS STRING * 4   'Language Extension (see note 4 below)
  49.     UserName AS STRING * 25 'User's Full Name (padded to 25 characters)
  50.     MinRemain AS INTEGER    'Calculated Minutes Remaining (see note 5 below)
  51.     NodeNum AS STRING * 1   'Node Number (or ' ' if no network)
  52.     EventTime AS STRING * 5 'Scheduled Event Time (in "HH:MM" format)
  53.     EventOn AS STRING * 2   'Is Event Active ("-1" = On, " 0" = Off)
  54.     EventSlide AS STRING * 2 'Slide Event ("-1" = On, " 0" = Off)
  55.     MemMesg AS SINGLE       'Memorized Message Number
  56.     ComPort AS STRING * 1   'Comm Port Number (0=none, 1-8)
  57.     Reserved1 AS STRING * 1 'Reserved for PCBoard
  58.     Reserved2 AS STRING * 1 'Reserved for PCBoard
  59.     ANSI AS STRING * 1      'Use ANSI (1 = Yes, 0 = No)
  60.     EventDate AS STRING * 8 'Last Event Date (in "MM-DD-YY" format)
  61.     EventMin AS INTEGER     'Last Event Minute (in minutes since midnight)
  62.     ExitToDOS AS STRING * 1 'Caller Exited to DOS (1 = Yes, 0 = No)
  63.     EventDue AS STRING * 1  'Event Up Coming (1 = Yes, 0 = No)
  64.     StopUploads AS STRING * 1 'Stop Uploads (1 = Yes, 0 = No)
  65.     ConfAreaIn AS INTEGER  ' Conference Area user was in (up to 65535)
  66. END TYPE
  67.  
  68. FUNCTION CheckDataBase(UserName$, Recs, FileHandle)
  69.    DIM CheckName AS STRING * 25
  70.    FOR X = 1 TO Recs
  71.       GET #FileHandle, X, CheckName$
  72.       IF UserName$ = CheckName$ THEN
  73.          CheckDataBase = 1
  74.          EXIT FUNCTION
  75.       END IF
  76.    NEXT X
  77.    PUT #FileHandle, Recs + 1, UserName$
  78.    CheckDataBase = 0
  79. END FUNCTION
  80.  
  81. DIM PCBSYS AS PCBSYSRECORD, Buffer AS STRING * 8192
  82. ConfigFile$ = "MORETIME.CFG"
  83.  
  84. IF NOT Exist(ConfigFile$) THEN                 'Check for Config file
  85.    PRINT CHR$(34); ConfigFile$; CHR$(34); " not found!"
  86.    SetLevel 20                                 'Return error code
  87.    END
  88. ELSE
  89.    OPEN ConfigFile$ FOR INPUT AS #1
  90.       INPUT #1, DataBaseFile$
  91.       INPUT #1, BadTextFile$
  92.       INPUT #1, GoodTextFile$
  93.       INPUT #1, TimeIncrease
  94.       INPUT #1, KBytesIncrease
  95.    CLOSE #1
  96. END IF
  97.  
  98. C$ = COMMAND$
  99. PCBDir$ = PDQParse$(C$)        'Get the PCBOARD.SYS location from Command Line
  100. IF RIGHT$(PCBDir$, 1) <> "\" THEN PCBDir$ = PCBDir$ + "\"
  101. SysFile$ = PCBDir$ + "PCBOARD.SYS"
  102. DoorTextFile$ = PCBDir$ + "PCBDOOR.TXT"
  103. Failed = 0
  104.  
  105. PRINT "MoreTime 1.10....Checking "; CHR$(34); SysFile$; CHR$(34)
  106.  
  107. IF NOT Exist(SysFile$) THEN                    'Check for PCBOARD.SYS file
  108.    PRINT CHR$(34); SysFile$; CHR$(34); " not found!"
  109.    SetLevel 10                                 'Return error code
  110. ELSE
  111.    OPEN SysFile$ FOR BINARY AS #1
  112.       GET #1,, PCBSYS
  113.       PRINT "User: "; PCBSYS.UserName$
  114.       IF Exist(DataBaseFile$) THEN
  115.          OPEN DataBaseFile$ FOR RANDOM AS #2 LEN = 25
  116.             Recs = LOF(2) \ 25
  117.             Failed = CheckDataBase(PCBSYS.UserName$, Recs, 2)
  118.          CLOSE #2
  119.       END IF
  120.       IF Failed THEN
  121.          PRINT "User has already accessed the Door!"
  122.          TextFile$ = BadTextFile$
  123.          SetLevel 1                                    'Return error code
  124.       ELSE
  125.          PRINT "User granted additonal Time & Bytes."
  126.          TextFile$ = GoodTextFile$
  127.          PCBSYS.CreditTime = PCBSYS.CreditTime + TimeIncrease
  128.          Connect = VAL(PCBSYS.Connect$)
  129.          PRINT "Connect:"; Connect
  130.          IF Connect = 0 THEN Connect = 2400
  131.          Adjusted = KBytesIncrease * (Connect \ 2400)
  132.          PRINT "Adjusted Bytes by:"; Adjusted
  133.          PRINT "Was:"; PCBSYS.DLKBytes
  134.          PCBSYS.DLKBytes = PCBSYS.DLKBytes + Adjusted
  135.          PRINT "Now:"; PCBSYS.DLKBytes
  136.          PUT #1,1, PCBSYS
  137.       END IF
  138.       FCopy TextFile$, DoorTextFile$, Buffer$, ErrCode%
  139.    CLOSE
  140. END IF
  141.